package work20241210.a_String;

import sun.util.resources.LocaleData;

import java.time.LocalDate;
import java.util.Arrays;

/**
 * @author zdl
 * @date 2024/12/10
 */
public class StringEquals {
    public static void main(String[] args) {
        String a =  "java";
        String b = "JAva";
        System.out.println(a.equals(b)); //判断是否相等
        System.out.println(a.equalsIgnoreCase(b)); //忽略大小写判断相等
        //转成字节数组
        byte[] bytes = a.getBytes();
        System.out.println(Arrays.toString(bytes));
        //转成字符数组
        char[] charArray = b.toCharArray();
        System.out.println(Arrays.toString(charArray));
        //大写转小写
        String lowerCase = a.toLowerCase();
        System.out.println(lowerCase);
        //小写转大写
        String upperCase = a.toUpperCase();
        System.out.println(upperCase);
        LocalDate currentDate = LocalDate.now();
        System.out.println(currentDate.getMonthValue());
        String s = String.valueOf(currentDate);
        System.out.println(s);
        System.out.println("=============================");

        //split 拆分
        String[] split = "CN-HN-ZZ-2401-01-01".split("-");
        System.out.println(Arrays.toString(split));
        for (int i1 = 0; i1 < split.length; i1++) {
            System.out.println(split[i1] );
        }

        // 截取字符串(子字符串),参数
        String substring = "411010200001011234".substring(6, 14);
        System.out.println("截取的字符串:" + substring );

        //replace 替换
        String replace = "java".replace("av","AV");
        System.out.println(replace);
    }
}
